<template>
	<view class="outer_box">
		<view class="title">
			手机号登录
		</view>
		<view class="card">
			<view class="input">
				<image src="https://xb-street.oss-cn-shanghai.aliyuncs.com/smallshop/static/login/shouji.png" mode=""></image>
				<input type="text" value="" placeholder="请输入手机号" />
			</view>

			<view class="input">
				<image src="https://xb-street.oss-cn-shanghai.aliyuncs.com/smallshop/static/login/shouji.png" mode=""></image>
				<input type="text" value="" placeholder="请输入验证码" />
				<!-- <button type="">获取验证码</button> -->
				<text v-if="timeFlag" class="time">
					{{timeCount}}
				</text>
				<text @tap="getCode" v-else class="getCode">
					获取验证码
				</text>
			</view>

		</view>
		<view class="btn-login">
			同意协议并登录
		</view>
		<privacy/>
		



	</view>
</template>

<script>
	export default {
		data() {
			return {
				timeFlag: false,
				timeCount: '',
			}
		},
		methods: {
			getCode() {
				this.$api_common.getVerificationCode({
					type:1,
					phone:this.parameter.phone
				}).then((res) => {
					if (res.data.code == 200) {
						this.timeFlag = true
						this.timeCount = this.totalTime + 's'
						let clock = setInterval(() => {
							this.totalTime--
							this.timeCount = this.totalTime + 's'
							if (this.totalTime < 0) { //当倒计时小于0时清除定时器
								clearInterval(clock)
								this.timeFlag = false
								this.totalTime = 59
							}
						}, 1000)
					} else {
						uni.showToast({
							title: res.data.message,
							duration: 1000,
							icon: "none"
						});
					}
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.outer_box {
		
		.btn-login {
			margin: 0 auto;
			width: 92%;
			height: 100upx;
			background: linear-gradient(90deg, #FF8308 0%, #FFBF69 100%);
			color: #FEFEFE;
			font-size: 32upx;
			line-height: 100upx;
			text-align: center;
		}

		.title {
			color: #fff;
			text-align: center;
			font-size: 32rpx;
		}

		.card {
			padding: 30rpx 20rpx;
			margin: 0 auto;
			margin-top: 50%;
			width: 650rpx;
			height: 220rpx;
			background: #FFFFFF;
			display: flex;
			flex-direction: column;

			.input {
				display: flex;
				flex-direction: row;
				align-items: center;
				height: 100rpx;
				border-bottom: 1rpx solid #EEEEEE;

				image {
					width: 48rpx;
					height: 48rpx;
					margin-right: 10rpx;
				}
				.time {
					border-radius: 30rpx;
					height: 55rpx;
					line-height: 55rpx;
					text-align: center;
					width: 180rpx;
					margin-left: 134rpx;
					color: #b1b1b1;
				}
				
				.getCode {
					color: #FF8308;
					font-size: 20rpx;
					width: 180rpx;
					height: 70rpx;
					background: #FFFFFF;
					border: 2rpx solid #FF8308;
					border-radius: 34rpx;
					line-height: 70rpx;
					text-align: center;
				}
			}

		}
	}

	page {
		height: 100%;
		background-image: url(https://xb-street.oss-cn-shanghai.aliyuncs.com/smallshop/static/login/login-bg.png);
		background-size: 100%;
	}
</style>
